import request from '@/utils/request'

export function groupTable(query) {
  return request({
    url: `${process.env.VUE_APP_MODULE_MALL_API}/api/mall/attr/group/table`,
    method: 'post',
    data: query
  })
}

export function groupLoad(query) {
  return request({
    url: `${process.env.VUE_APP_MODULE_MALL_API}/api/mall/attr/group/load`,
    method: 'get',
    params: query
  })
}

export function groupSave(query) {
  return request({
    url: `${process.env.VUE_APP_MODULE_MALL_API}/api/mall/attr/group/save`,
    method: 'post',
    data: query
  })
}

export function groupDelete(query) {
  return request({
    url: `${process.env.VUE_APP_MODULE_MALL_API}/api/mall/attr/group/delete`,
    method: 'post',
    data: query
  })
}

export function groupRelationTable(groupId, query) {
  return request({
    url: `${process.env.VUE_APP_MODULE_MALL_API}/api/mall/attr/group/${groupId}/relation/table`,
    method: 'post',
    data: query
  })
}

export function groupUnRelationTable(groupId, query) {
  return request({
    url: `${process.env.VUE_APP_MODULE_MALL_API}/api/mall/attr/group/${groupId}/unRelation/table`,
    method: 'post',
    data: query
  })
}

export function groupRelationSave(groupId, query) {
  return request({
    url: `${process.env.VUE_APP_MODULE_MALL_API}/api/mall/attr/group/${groupId}/relation/save`,
    method: 'post',
    data: query
  })
}

export function groupRelationDelete(groupId, query) {
  return request({
    url: `${process.env.VUE_APP_MODULE_MALL_API}/api/mall/attr/group/${groupId}/relation/delete`,
    method: 'post',
    data: query
  })
}

export function attrValueList(query) {
  return request({
    url: `${process.env.VUE_APP_MODULE_MALL_API}/api/mall/attr/group/attr_value/list`,
    method: 'post',
    data: query
  })
}

export function groupAttrInfo(catalogId, query) {
  return request({
    url: `${process.env.VUE_APP_MODULE_MALL_API}/api/mall/attr/group/${catalogId}/detail/list`,
    method: 'post',
    data: query
  })
}
